TST: mark test_set_stats_level as thread_unsafe - #2782
Merged
lijinf2 merged 1 commit intoSep 9, 2026
Conversation
cuFile stats level is process-global state (a C library global variable inside libcufile). Running test_set_stats_level concurrently with test_stats_start_stop (which also calls set_stats_level(1)) can cause a race condition where get_stats_level() returns the value set by the other test, failing the assertion. All other cuFile stats tests (test_stats_start_stop, test_get_stats_l1/l2/l3) were already marked thread_unsafe; this commit fixes the oversight for test_set_stats_level.
Contributor
Contributor
Author
|
/ok to test ce46dec |
This comment has been minimized.
This comment has been minimized.
seberg
approved these changes
Sep 9, 2026
seberg
left a comment
Contributor
There was a problem hiding this comment.
Thanks! Could probably have guessed that this isn't thread-safe even if I didn't observe the flakiness :).
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
test_set_stats_levelwas missing the@pytest.mark.thread_unsafemarker, causing a flaky race condition when tests run in parallel. See CI logRoot Cause
cuFile's stats level is a process-global C library variable accessed via
cufile.set_stats_level()/cufile.get_stats_level(). Whentest_set_stats_levelruns concurrently withtest_stats_start_stop(which explicitly callsset_stats_level(1)), the following race can occur:Fix
Add
@pytest.mark.thread_unsafe(reason="cuFile stats level is process-global")totest_set_stats_level.All other cuFile stats tests (
test_stats_start_stop,test_get_stats_l1,test_get_stats_l2,test_get_stats_l3) were already markedthread_unsafe. This was an oversight introduced when those markers were added in #2218.